window.onload = function(){
    window.onload = function () {
        var isDaoDi = document.body.scrollTop+document.body.clientHeight  ==document.body.scrollHeight;
        if(isDaoDi){
            loadNextPageData();
        }
    }
};
loadNextPageData();
function loadNextPageData(data){

    $.ajax({
        url:"https://s.taobao.com/search?data-key=s&data-value=88&ajax=true&_ksTS=1530251206954_802&q=dw%E5%A5%B3%E8%A1%A8&imgfile=&js=1&stats_click=search_radio_all%3A1&initiative_id=staobaoz_20180629&ie=utf8&bcoffset=1&p4ppushleft=1%2C48&s=44&ntoffset=7",
        dataType:"jsonp",
        success:function(data){
            loadData(data);
        }
    });
}
function loadData(data){
    var productArr = data.mods.itemlist.data.auctions;
    for(var i=0;i<productArr.length;i++){
        var p = productArr[i];
        var productDiv = document.createElement("div");
        productDiv.className = "product fl";


        var jiaGeDiv = document.createElement("div");
        jiaGeDiv.className = "jiaGe";
        jiaGeDiv.innerHTML = "￥"+p.view_price;
        var fkDiv = document.createElement("div");
        fkDiv.className = "fk fr";
        fkDiv.innerHTML = p.view_sales;
        var image = document.createElement("img");
        image.src = "http:"+p.pic_url+"_360x360Q90.jpg_.webp";
        var bySpan= document.createElement("span");
        bySpan.className = "by";
        var titleDiv = document.createElement("div");
        titleDiv.className = "title";
        var text=document.createElement("span");
        text.innerHTML = p.title;
        var dpDiv = document.createElement("div");
        dpDiv.className = "dp";
        var dpm = document.createElement("span");
        dpm.innerHTML = p.nick;
        var shSpan = document.createElement("span");
        shSpan.className = "sh";
        var dsrSpan = document.createElement("span");
        dsrSpan.className = "dsr";
        var dsr1Span = document.createElement("span");
        dsr1Span.className = "dsr1";
        var dsr2Span = document.createElement("span");
        dsr2Span.className = "dsr2";



        productDiv.appendChild(image);
        productDiv.appendChild(fkDiv);
        titleDiv.appendChild(bySpan);
        titleDiv.appendChild(text);
        productDiv.appendChild(jiaGeDiv);
        productDiv.appendChild(titleDiv);
        productDiv.appendChild(dpDiv);
        dpDiv.appendChild(shSpan);
        dpDiv.appendChild(dpm);
        shSpan.appendChild(dsrSpan);
        shSpan.appendChild(dsr1Span);
        shSpan.appendChild(dsr2Span);

        productDiv.p = p;
        productDiv.onclick = function(){
            localStorage.setItem("currentP",JSON.stringify(this.p));
            location = "xqy.html";
        };





        productList.appendChild(productDiv);
    }
}